<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>Books</title>
</head>
<body>
<h1>图书管理</h1>
<hr>
<div th:include="commons/topBar :: topBar"></div>

<h3 shiro:hasRole="admin"><a th:href="@{/book/toAddBook}">增加图书</a></h3>
<form th:action="@{/book/searchBook}" method="post">
    isbn：<input type="text" name="isbn">    |
    图书名称：<input type="text" name="bookName">
    <input type="submit">
</form>
<table border="1">
    <tr>
        <th>序号</th>
        <th>isbn</th>
        <th>书名</th>
        <th>出版社ID</th>
        <th>价格</th>
        <th>数量</th>
        <th>简介</th>
        <th>操作</th>
    </tr>
    <tr th:each="book, bookIndex : ${bookList}">
        <td th:text="${bookIndex.index + 1}"></td>
        <td th:text="${book.isbn}"></td>
        <td th:text="${book.bookName}"></td>
        <td th:text="${book.publisherID}"></td>
        <td th:text="${book.price}"></td>
        <td th:text="${book.count}"></td>
        <td th:text="${book.description}"></td>
        <td>
            <a th:href="@{/book/toUpdateBook/{isbn}(isbn = ${book.isbn})}">编辑</a>
            <a th:href="@{/book/deleteBook/{isbn}(isbn = ${book.isbn})}">删除</a>
        </td>
    </tr>
</table>
</body>
</html>